// pages/home/home.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    
  },

  today(e){
    //缓存中获取openId
    let openid = wx.getStorageSync('openId');
    if(openid != null && openid != ""){
      wx.request({
        url: 'http://localhost:8060/user/queryStatus',
        method: 'POST',
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: {
          openid
        },
        success(responseData){
          let status = responseData.data.infoStatus;
          if(status == 1){
            wx.navigateTo({
            url: '/pages/registration/today/inputInfo/inputInfo',
          })
          }else if(status == 0){
            console.log(status == 0);
            wx.navigateTo({
              url: '/pages/add/addpage/addpage',
            })
          }else{
            wx.showToast({
              title: '请重新登录后再试一次',
              icon: 'none'
            })
          }
        }    
      });
    }else{
      wx.showToast({
        title: '请登录后再进行操作！',
        icon: 'none'
      })
    }
    
  },
  yuyue(e){
    //缓存中获取openId
    let openid = wx.getStorageSync('openId');
    if(openid != null && openid != ""){
      wx.request({
        url: 'http://localhost:8060/user/queryStatus',
        method: 'POST',
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: {
          openid
        },
        success(responseData){
          let status = responseData.data.infoStatus;
          if(status == 1){
            wx.navigateTo({
              url: '/pages/registration/appoint/inputInfo/inputInfo',
            })
          }else if(status == 0){
            console.log(status == 0);
            wx.navigateTo({
              url: '/pages/add/addpage/addpage',
            })
          }else{
            wx.showToast({
              title: '请重新登录后再试一次',
              icon: 'none'
            })
          }
        }    
      });
    }else{
      wx.showToast({
        title: '请登录后再进行操作！',
        icon: 'none'
      })
    }
  },
  find(e){

    //缓存中获取openId
    let openid = wx.getStorageSync('openId');
    if(openid != null && openid != ""){
      wx.request({
        url: 'http://localhost:8060/user/queryStatus',
        method: 'POST',
        header: { "content-type": "application/x-www-form-urlencoded" },
        data: {
          openid
        },
        success(responseData){
          let status = responseData.data.infoStatus;
          if(status == 1){
            wx.navigateTo({
              url: '/pages/registration/find/find',
            })
          }else if(status == 0){
            console.log(status == 0);
            wx.navigateTo({
              url: '/pages/add/addpage/addpage',
            })
          }else{
            wx.showToast({
              title: '请重新登录后再试一次',
              icon: 'none'
            })
          }
        }    
      });
    }else{
      wx.showToast({
        title: '请登录后再进行操作！',
        icon: 'none'
      })
    }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
  },
})